import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import request from "@/utils/request";
import "@/assets/global.css"
import moment from "moment"
import { getDataByType } from '@/apis/dict/data'
import {selectDictLabel, resetForm, getAge, getCurrentTimeType, addDateRange, handleTree} from "@/utils/hos_utils"
import dayjs from 'dayjs'



// 定义全局过滤器
Vue.filter('dateFormat', date => {
    return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
})
Vue.filter('dateFormat2', date => {
    return dayjs(date).format('YYYY-MM-DD')
})
Vue.config.productionTip = false
// 1.将axios挂载到Vue对象
Vue.prototype.$http = request;
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.addDateRange = addDateRange
Vue.prototype.handleTree = handleTree // 挂载全局的构造树的JSON的方法
Vue.prototype.resetForm = resetForm
Vue.prototype.moment = moment
Vue.prototype.getCurrentTimeType = getCurrentTimeType// 挂载全局计算时段的方法
Vue.prototype.getDataByType = getDataByType // 加载全局的根据字典类型查询字典的方法[基本每个页面都要使用]
Vue.prototype.getAge = getAge// 挂载全局的根据出生年月日计算年龄的方法
Vue.prototype.msgSuccess = function (msg) {
    this.$message({showClose: true, message: msg, type: 'success'})
}
Vue.prototype.msgError = function (msg) {
    this.$message({showClose: true, message: msg, type: 'error'})
}




new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
